#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <vector>

using namespace std;

struct ListNode {
    int val;
    ListNode* next;
    ListNode(int x) : val(x), next(NULL) {}
};

struct TreeNode {
    int val;
    TreeNode* left;
    TreeNode* right;
    TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};

class Solution {
   public:
    ListNode* reverseList(ListNode* head) {
        if (head == NULL) return NULL;
        ListNode *ret = new ListNode(-1), *slow = head, *fast = head->next;
        ret->next = NULL;
        while (slow != NULL) {
            slow->next = ret->next;
            ret->next = slow;
            slow = fast;
            if (fast) {
                fast = fast->next;
            }
        }
        return ret->next;
    }
};

int main() {
    cout << "Hello, World!";
    ListNode* tmp = new ListNode(1);
    tmp->next = new ListNode(2);
    tmp->next->next = new ListNode(3);
    tmp->next->next->next = new ListNode(4);
    tmp->next->next->next->next = new ListNode(5);
    ListNode* ret = Solution().reverseList(tmp);
    return 0;
}